<?php

/**
 * memberzoneComments actions.
 *
 * @package    jobeet
 * @subpackage memberzoneComments
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class memberzoneOrdersActions extends sfActions
{
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
  public function executeIndex(sfWebRequest $request)
  {
    $this->forward('default', 'module');
  }

  public function executeDeleteOrder(sfWebRequest $request){
	$order = Doctrine::getTable('ProductOrder')->findOneByPublicUserIdAndId(
		$this->getUser()->getObject()->getId(),
		$request->getParameter('orderID', -1)
	);


	if($order){
		$order['is_hidden'] = true;
		$order->save();
	}


	$this->redirect($request->getReferer());

  }

	public function executeRenameOrder( $request ){
		$this->setLayout(false);
		
		$this->order = Doctrine::getTable('ProductOrder')->findOneByPublicUserIdAndId(
			$this->getUser()->getObject()->getId(),
			$request->getParameter('orderID', -1)
		);

		$this->order->setTitle($this->getRequestParameter('name'));
		$this->order->save();

		return $this->renderPartial('global/json', array('item' => array('name' => $this->order['title'] )));

	}
}
